home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trading on the Edge
/
Trading On The Edge - CD-ROM Toolkit (Wayzata Technology)(2031)(1994).bin
/
pc
/
mac_file
/
vendor_d
/
neuralwa
/
nw2v50
/
uio_cmds.c
< prev
next >
Wrap
Text File
|
1993-08-23
|
23KB
|
752 lines
/* uio_cmds.c */
/************************************************************************
* Copyright(C) 1987-1992 NeuralWare Inc *
* Penn Center West, IV-227, Pittsburgh, PA 15276 *
* Telephone: (412) 787-8222 FAX: (412) 787-8220 *
* *
* All rights reserved. No part of this program may be reproduced, *
* stored in a retrieval system, or transmitted, in any form or by any *
* means, electronic, mechanical, photocopying, recording or otherwise *
* without the prior written permission of the copyright owner, *
* NeuralWare, Inc. *
* *
* PROPRIETARY NOTICE *
* *
* This document is the property of NeuralWare, Inc. and contains *
* trade-secrets and other proprietary information. The information *
* herein is reserved as proprietary to NeuralWare, and is not to be *
* published, reproduced, copied, disclosed, used, or reverse *
* engineered without the express written consent of a duly authorized *
* representative of NeuralWare. *
************************************************************************
*/
/*******************************************************************/
/* */
/* uio_cmds.c - User IO program template showing format of all */
/* all commands from NeuralWorks. A User program */
/* must provide all these functions */
/* */
/* Documentation: TR Young December 27, 1990 */
/* Author: John C. Fairman August 31, 1990 */
/* Copyright 1990 by NeuralWare Inc. */
/* */
/* $Author : $ */
/* $Date : $ */
/* $Source : $ */
/* $Revision : $ */
/* $Log : $ */
/* */
/*******************************************************************/
/*
*
* Functions necessary for handling the User I/O package itself:
*
* UIO_Init()
* UIO_Term()
* UIO_Attention()
*
*
* Functions necessary for handling a learning session:
*
* UIO_Learn_Start()
* UIO_Learn_Input()
* UIO_Learn_Output()
* UIO_Learn_Result()
* UIO_Learn_End()
*
*
* Functions necessary for handling a recall or testing session:
*
* UIO_Recall_Start()
* UIO_Read()
* UIO_Write()
* UIO_Write_Step()
* UIO_Recall_Test()
* UIO_Recall_End()
*
*
* Other miscellaneous functions:
*
* UIO_Instrument()
* UIO_ObjFunc()
* UIO_Rewind()
* UIO_Explain()
*
*
* Note: All these functions must be defined to avoid link errors.
* Fill in the ones you need for your UserIO program.
*/
/******************************************************************
* NOTE: Do not include <stdio.h>. This is dealt with in userutl.h
* and related files. Some platforms, such as the Macintosh, redefine
* the stdio functions.
*
*/
#define UIO_SERVER 1
#define SERVER_EMULATOR_FILE 1
#define SKIP_COMPAT_DATA 1
#include "userutl.h"
#include "uio_strc.h"
#include "uio_tran.h"
#include "uio_reqs.pro"
#include "uio_cmds.pro"
#ifdef MAC
#include "macuio.redef"
#endif
/*******************************************************************/
/* */
/* Functions necessary for handling the User I/O package itself. */
/* */
/*******************************************************************/
/* function: UIO_Init.c
* Executed once by NWorks at the begining of User IO execution.
* Used for function initialization, memory allocation, file openning.
*
* arguments: file = name of the User IO program being executed
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Init(file)
TEXT *file;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/**/
/* function: UIO_Term()
* Executed once by NWorks before loading another User IO program
* or whenever deleting the network using either menu selections
* or dialog boxes:
*
* IO...||Parameters||USRIO filename selection
* File...||Open...||NWorks filename selection
* File...||New
* File...||Close
* File...||Revert to Saved
* File...||Quit
*
* Used to release all allocated memory, close any open files, etc.
* to clean up after the User IO program execution
*
* arguments: process = integer number assigned to User IO task
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Term(process)
NINT process;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/* function: UIO_Attention()
* Executed once by NWorks at menu selection:
*
* I/O...||Attention I/O
*
* Used for function initialization,
* keyboard input of learn/recall parameters, etc.
*
* Also used for the main body of a User Control program
*
* arguments: none
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Attention()
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/*******************************************************************/
/* */
/* Functions necessary for handling a learning session. */
/* */
/*******************************************************************/
/* function: UIO_Learn_Start()
* Executed by NWorks at the begining of learn exectution
* from menu selections:
* Run...||Learn...||For nn
* Run...||Learn...||One Pass/All
* Run...||Learn...||One
* Run...||Learn...||Now
* Run...||Learn...||Until
*
* Used for function initialization,
* keyboard input of learn parameters, etc.
*
* arguments: none
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Learn_Start()
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/**/
/* function: UIO_Learn_Input.c
* Executed by NWorks during learn execution whenever a
* control strategy instruction:
*
* io lrnin
*
* is encountered.
* Used for reading predictor variable (i.e. Input or X in Y=f(X))
* information into network.
*
* arguments: LayN = index assigned to the layer that
* will receive the input data;
* index is assigned according to relative
* (to other layers) screen position
*
* nPEs = dimension of the input data array
*
* Datap = pointer to array to be filled with input data
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Learn_Input(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/* function: UIO_Learn_Output()
* Executed by NWorks during learn execution whenever a
* control strategy instruction:
*
* io lrnout
*
* is encountered.
* Used for reading observed response variable
* (i.e. desired Output or Y in Y=f(X))
* information into network.
*
* arguments: LayN = index assigned to the layer that
* will receive the input data;
* index is assigned according to relative
* (to other layers) screen position
*
* nPEs = dimension of the input data array
*
* Datap = pointer to array to be filled with input data
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Learn_Output(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/**/
/* function: UIO_Learn_Result()
* Executed by NWorks during learn execution given a
* control strategy instruction:
*
* io lrnrslt
*
* is encountered.
* Nworks returns predicted response (i.e. Result or
* Y-hat in Y=f(X) where f is the estimated network)
* information caluclated by network.
*
* arguments: LayN = index assigned to the layer that
* returns the predicted response output;
* index is assigned according to relative
* (to other layers) screen position
*
* nPEs = dimension of the output data array
*
* Datap = pointer to array that contains output data
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Learn_Result(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/* function: UIO_Learn_End()
* Called by NWorks at the end of learn exectution.
* Used for summary information of learn procedure.
*
* arguments: none
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Learn_End()
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/**/
/*******************************************************************/
/* */
/* Functions necessary for handling a recall or testing session. */
/* */
/*******************************************************************/
/* function: UIO_Recall_Start()
* Executed once by NWorks at the beginning of recall execution
* from menu selections:
*
* Run...||Test...||For nn
* Run...||Test...||One Pass/All
* Run...||Test...||One
* Run...||Recall...||For nn
* Run...||Recall...||One Pass/All
* Run...||Recall...||One
* Run...||Recall...||Now
*
* Used for function initialization,
* keyboard input of recall parameters, etc.
*
* arguments: none
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Recall_Start()
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/* function: UIO_Read()
* Executed by NWorks during learn execution whenever a
* control strategy instruction:
* read
* is encountered.
* Used for supplying predictor variable
* (i.e. Input or X in Y=f(X))
* information to NWorks network.
*
* arguments: LayN = index assigned to the layer that
* will receive the input data;
* index is assigned according to relative
* (to other layers) screen position
*
* nPEs = dimension of the input data array
*
* Datap = pointer to array to be filled with input data
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Read(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/* function: UIO_Write()
* Executed by NWorks during learn execution whenever a
* control strategy instruction:
* rcltst
* is encountered.
* Nworks gives User IO predicted response
* (i.e. Actual Output or Y-hat in Y=f(X) where
* f is the NWorks estimated network)
* information from the NWorks network.
*
* arguments: LayN = index assigned to the layer that
* returns the predicted response output;
* index is assigned according to relative
* (to other layers) screen position
*
* nPEs = dimension of the output data array
*
* Datap = pointer to array that contains output data
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Write(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
#ifdef _MSC_VER
ret_val = 567;
/* printf("set return value to %d\n",ret_val); */
#endif
return(ret_val);
}
/* function: UIO_Write_Step()
* Executed by NWorks during learn execution whenever a
* control strategy instruction:
* wrstep
* is encountered.
* Nworks gives User IO predicted partial response
* (i.e. Actual Output or Y-hat in Y=f_j(X) where
* f_j is the j is the LayN-th layer of the NWorks
* estimated network) at the specified layer using
* information supplied to, and caluclated by, the network.
*
* arguments: LayN = index assigned to the layer that
* returns the predicted partial response output;
* index is assigned according to relative
* (to other layers) screen position
*
* nPEs = dimension of the output data array
*
* Datap = pointer to array that contains output data
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Write_Step(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/**/
/* function: UIO_Recall_Test()
* Executed by NWorks during learn execution whenever a
* control strategy instruction:
* rcltst
* is encountered.
* Used for supplying observed response variable
* (i.e. Test data or Desired Output or Y in Y=f(X))
* information to NWorks network.
*
* arguments: LayN = index assigned to the layer that
* will receive the input data;
* index is assigned according to relative
* (to other layers) screen position
*
* nPEs = dimension of the input data array
*
* Datap = pointer to array to be filled with input data
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Recall_Test(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/* function: UIO_Recall_End()
* Executed once by NWorks at the end of recall execution
* from menu selection:
*
* Run...||Test...||For nn
* Run...||Test...||One Pass/All
* Run...||Test...||One
* Run...||Recall...||For nn
* Run...||Recall...||One Pass/All
* Run...||Recall...||One
* Run...||Recall...||Now
*
* Used for function initialization,
* keyboard input of learn parameters, etc.
*
* arguments: none
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Recall_End()
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/**/
/*******************************************************************/
/* */
/* Other miscellaneous functions. */
/* */
/*******************************************************************/
/* function: UIO_Instrument()
* Executed by NWorks whenever an instrument generates
* logging output that is sent to UIO
* (User IO selected for logging in instrument edit dialog box)
*
* arguments: Instrument_id = integer assigned to instrument
* that sent logging output
* nDataElems = integer dimension of array
* that holds logging output
* DataElemp = floating pointer to array
* that holds logging output
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Instrument(Instrument_id, nDataElems, DataElemp)
NINT Instrument_id;
NINT nDataElems;
SREAL *DataElemp;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/* function: UIO_ObjFunc()
* Executed by NWorks when the NeuralWorks Objective function
* is specified as UserIO, called during a NeuralWorks SaveBest
* at start of testing and at the end of testing.
*
* arguments:
* eoeflag = 0 (start of testing), =1 (end of testing)
* DataElemp = place to put objective function output
* (eoeflag = 1 only)
* DataElemp[0] = value;
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_ObjFunc(eoeflag, DataElemp)
NINT eoeflag;
SREAL *DataElemp;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/* function: UIO_Rewind()
* Executed once by NWorks from menu selections:
*
* I/O...||Rewind Input...||All
* I/O...||Rewind Input...||Learn
* I/O...||Rewind Input...||Rcl/Test
* I/O...||Rewind Input...||Close File(s)
*
* Used for input file rewinding, closing files
*
* arguments: none
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Rewind()
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}
/**/
/* function: UIO_Explain()
* Executed by NWorks once for each PE in the Output Layer
* during menu selections:
*
* Run...||Explain...||For nn
* Run...||Explain...||One Pass/All
* Run...||Explain...||One
* Run...||Explain...||Now
*
* Allows input of information for the NWorks Explain feature.
*
* arguments: LayN = index assigned to the layer that
* will receive the predicted response output;
* index is assigned according to relative
* (to other layers) screen position
*
* nPEs = dimension of the input data array, the number
* of PE's in the input layer
*
* Datap = pointer to array that contains input data
*
* return: UIO_OK = 0, continue execution, do not update screen
* UIO_UPDATE = 1, continue execution, do update screen
* UIO_EXIT = 2, terminate execution, no error, update screen
* UIO_ERROR = -1, terminate execution, do update screen
*/
NINT UIO_Explain(LayN, nPEs, Datap)
NINT LayN;
NINT nPEs;
SREAL *Datap;
{
NINT ret_val = UIO_OK;
/* USER TO PLACE CODE HERE */
return(ret_val);
}